<!DOCTYPE html>
<html>
  <head>
    <script src="../dist/jspsych.js"></script>
    <script src="../dist/plugin-image-keyboard-response.js"></script>
    <script src="../dist/plugin-preload.js"></script>
    <link rel="stylesheet" href="../dist/jspsych.css">
  </head>
  <body></body>
  <script>

    var jsPsych = initJsPsych({
      on_finish: function() {
        jsPsych.data.displayData();
      }
    });

    var preload = {
      type: jsPsychPreload,
      auto_preload: true
    };

    var block_1 = {
      type: jsPsychImageKeyboardResponse,
      stimulus: 'img/happy_face_1.jpg',
      choices: ['y','n'],
      prompt: '<p>Data for this trial should have a random int 0-19 on next page. Press "y" or "n".</p>',
      stimulus_width: 300,
      data: function() {
        return {
          random_number: Math.floor(Math.random() * 20)
        }
      }
    };

    jsPsych.run([preload, block_1]);

  </script>
</html>
